package zorg.example.rest_demo.boot

import org.springframework.context.annotation.Configuration
import org.springframework.data.rest.core.config.RepositoryRestConfiguration
import org.springframework.data.rest.webmvc.config.RepositoryRestConfigurer
import org.springframework.web.servlet.config.annotation.CorsRegistry
import zorg.example.rest_demo.entity.Class
import zorg.example.rest_demo.entity.Student

@Configuration
class RestConfiguration : RepositoryRestConfigurer {
    override fun configureRepositoryRestConfiguration(config: RepositoryRestConfiguration, cors: CorsRegistry) {
        config.exposeIdsFor(Class::class.java, Student::class.java)
        cors.addMapping("/student/**")
        cors.addMapping("/class/**")
    }
}